<%--
  Created by IntelliJ IDEA.
  User: 邢式瑞
  Date: 2022/9/3
  Time: 10:36
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="regist" method="post" onsubmit="return checkForm()">
    <table border="1" width="60%" align="center">
        <tr>
            <td>用户名</td>
            <td><input name="username" type="text" id="username" ></td>
        </tr>
        <tr>
            <td>密码 </td>
            <td><input name="password" type="password" id="password"></td>
        </tr>
        <tr>
            <td><input type="submit" value="注册"></td>
            <td><a href="${pageContext.request.contextPath}/login.jsp" type="button" >返回</a></td>
        </tr>
    </table>
</form>
<script type="text/javascript">
    function checkForm() {
        let username=document.getElementById("username").value;
        let pwd=document.getElementById("pwd").value;
        if(username==null||username.trim().length==0){
            alert("请输入用户名");
            return false;
        }
        if(pwd==null||pwd.trim().length==0){
            alert("请输入密码");
            return false;
        }
        return true;
    }
</script>
</body>
</html>
